<template>
    <div class="content">

        <!--检查事件-->
        <div style="width: 100%">
          <div class="bname" ref="block0">检查事件</div>
            <div class="block" style="margin-top: 0.5%;">
              <el-form ref="form" :model="basicForm" label-width="140px">
                <el-form-item label="检查类型">
                  <el-radio-group v-model="basicForm.pathologySpecimenType" onclick="return false">
                    <el-radio label="01">放射检查（X片，CT，MRI等）</el-radio>
                    <el-radio label="02">B超</el-radio>
                    <el-radio label="03">心/肌电图</el-radio>
                    <el-radio label="04">胃/肠镜</el-radio>
                    <el-radio label="05">其他</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="是否为侵入性操作">
                  <el-radio-group v-model="basicForm.examineSpecimenInvasive" onclick="return false">
                    <el-radio label="01">是</el-radio>
                    <el-radio label="02">否</el-radio>
                    <el-radio label="03">不清楚</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="错误类型">
                  <el-radio-group v-model="basicForm.pathologyErrorType" onclick="return false">
                    <el-radio label="01">容器错误</el-radio>
                    <el-radio label="02">漏采集</el-radio>
                    <el-radio label="03">标本类型错误</el-radio>
                    <el-radio label="04">采集时间错误</el-radio>
                    <el-radio label="05">量或质量问题</el-radio>
                    <el-radio label="06">运送延迟</el-radio>
                    <el-radio label="07">标本遗失</el-radio>
                    <el-radio label="08">患者错误</el-radio>
                    <el-radio label="09">报告出错</el-radio>
                    <el-radio label="10">其他</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-form>
            </div>
        </div>


      <!--事件情况描述-->
      <div style="width: 100%">
        <div class="bname" ref="block1" style="border-top: 1px solid rgba(165,169,175,0.29);padding-top:0.5%">事件情况描述</div>
        <div class="block" style="margin-top: 0.5%;">
          <el-form ref="reportForm" :model="reportForm" label-width="140px">
            <el-form-item label="事件描述或事件经过">
              <el-input type="textarea" v-model="reportForm.situationEdescriptionProcess" placeholder="请输入内容"
                        style="width: 300px"
                        :rows="3" resize="none" :readonly="true"></el-input>
            </el-form-item>
            <el-form-item label="事件发生时是否采取处理措施">
              <el-radio-group v-model="reportForm.situationMeasuresEvent" onclick="return false">
                <el-radio label="01">是</el-radio>
                <el-radio label="02">否</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="采取的处理措施">
              <el-input type="textarea" v-model="reportForm.situationTakenMeasures" placeholder="请输入内容"
                        style="width: 300px"
                        :rows="3" resize="none" :readonly="true"></el-input>
            </el-form-item>
            <div v-if="reportForm.situationMeasuresEvent==='01'">
              <el-form-item label="事件所引起的后果" >
                <el-input v-model="reportForm.situationCausesconsequences" placeholder="请输入内容"
                          style="width: 300px" :readonly="true"></el-input>
              </el-form-item>
            </div>
          </el-form>
        </div>
      </div>

      <!--患者资料-->
      <div style="width: 100%">
        <div class="bname" ref="block2" style="border-top: 1px solid rgba(165,169,175,0.29);padding-top:0.5%">患者资料</div>
        <div class="block" style="margin-top: 0.5%;">
          <el-form ref="reportform1" :model="reportForm" :rules="rules" label-width="140px">
            <div style="margin-left: 1%">
              <el-form-item label="是否涉及患者">
                <el-radio-group v-model="reportForm.patientInvolved" onclick="return false" style="width: 200px">
                  <el-radio label="01">是</el-radio>
                  <el-radio label="02">否</el-radio>
                </el-radio-group>
              </el-form-item>
              <div class="painter" v-if="reportForm.patientInvolved==='01'">
                <el-form-item label="诊断类别">
                  <el-radio-group v-model="reportForm.patientDiagnosisCategory" onclick="return false">
                    <el-radio label="01">急诊</el-radio>
                    <el-radio label="02">门诊</el-radio>
                    <el-radio label="03">住院</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="病历号/门诊号">
                  <el-input type="textarea" v-model="reportForm.patientRecordOutpatient" placeholder="请输入内容"
                            style="width:300px" resize="none" :readonly="true"></el-input>
                </el-form-item>
                <el-form-item label="姓名" prop="patientName">
                  <el-input type="textarea" v-model="reportForm.patientName" placeholder="请输入内容" style="width: 300px"
                            resize="none" :readonly="true"></el-input>
                </el-form-item>
                <el-form-item label="性别">
                  <el-radio-group v-model="reportForm.patientGender" onclick="return false">
                    <el-radio label="01">男</el-radio>
                    <el-radio label="02">女</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="出生日期">
                  <el-date-picker
                    v-model="reportForm.patientDateOfBirth"
                    type="datetime"
                    placeholder="选择日期时间" :readonly="true">
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="年龄阶段">
                  <dict-tag style="font-size: 15px;color: #dd524d" :options="dict.type.he_patient_age_grades" :value="reportForm.patientAgeStage"/>
                </el-form-item>
                <el-form-item label="家属联系电话">
                  <el-input v-model="reportForm.patientFamilyNumber" placeholder="请输入内容" style="width: 220px" :readonly="true"></el-input>
                </el-form-item>
                <el-form-item label="入院就诊时间">
                  <el-date-picker
                    v-model="reportForm.patientAdmissionTime"
                    type="datetime"
                    placeholder="选择日期时间" :readonly="true">
                  </el-date-picker>
                </el-form-item>
<!--                <el-form-item label="科室">-->
<!--                  <dict-tag style="font-size: 15px;color: #dd524d" :options="dict.type.he_department_name" :value="reportForm.patientDepartment"/>-->
<!--                </el-form-item>-->
                <el-form-item label="床号">
                  <el-input v-model="reportForm.patientBedNumber" placeholder="请输入内容" style="width: 220px" :readonly="true"></el-input>
                </el-form-item>
                <el-form-item label="护理级别">
                  <el-radio-group v-model="reportForm.patientNursingLevel" onclick="return false">
                    <el-radio label="01">特级护理</el-radio>
                    <el-radio label="02">Ⅰ级护理</el-radio>
                    <el-radio label="03">Ⅱ级护理</el-radio>
                    <el-radio label="04">Ⅲ级护理</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="文化程度">
                  <el-radio-group v-model="reportForm.patientEducationLevel" onclick="return false">
                    <el-radio label="01">研究生</el-radio>
                    <el-radio label="02">大学本科</el-radio>
                    <el-radio label="03">大学专科</el-radio>
                    <el-radio label="04">中专（中技）</el-radio>
                    <el-radio label="05">高中</el-radio>
                    <el-radio label="06">初中</el-radio>
                    <el-radio label="07">小学</el-radio>
                    <el-radio label="08">文盲</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="诊断（多个诊断之间用逗号隔开）">
                  <el-input type="textarea" v-model="reportForm.patientDiagnosis" placeholder="请输入内容" style="width: 300px"
                            :rows="6" resize="none" :readonly="true"></el-input>
                </el-form-item>
              </div>
            </div>
          </el-form>
        </div>
      </div>

      <!--事件基本信息-->
      <div style="width: 100%">
        <div class="bname" ref="block3" style="border-top: 1px solid rgba(165,169,175,0.29);padding-top:0.5%">事件基本信息</div>
        <div class="block" style="margin-top: 0.5%;">
          <el-form ref="reportForm" :model="reportForm" label-width="140px">
            <el-form-item label="发生时间">
              <el-date-picker
                v-model="reportForm.occurrenceTime"
                type="datetime"
                placeholder="选择日期时间" :readonly="true">
              </el-date-picker>
            </el-form-item>
            <el-form-item label="发生日期">
              <el-date-picker
                v-model="reportForm.occurrenceDate"
                type="datetime"
                placeholder="选择日期时间" :readonly="true">
              </el-date-picker>
            </el-form-item>
            <el-form-item label="日期类型">
              <el-radio-group v-model="reportForm.occurrenceDateType" onclick="return false">
                <el-radio label="工作日"></el-radio>
                <el-radio label="周末"></el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="发生时段">
              <el-radio-group v-model="reportForm.occurrenceTimePeriod" onclick="return false">
                <el-radio label="01">上午(08：00-12：00)</el-radio>
                <el-radio label="02">中午(12：00-14：00)</el-radio>
                <el-radio label="03">下午(14：00-18：00)</el-radio>
                <el-radio label="04">上夜(18：00-00：00)</el-radio>
                <el-radio label="05">下夜(00：00-08：00)</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="发生地点">
              <el-input type="textarea" v-model="reportForm.occurrenceLocation" placeholder="请输入内容" style="width:220px"
                        resize="none" :readonly="true"></el-input>
            </el-form-item>
            <el-form-item label="现场照片" prop="images">
              <image-upload :limit="1" v-model="reportForm.occurrenceScenePhotos" :readonly="true" />
            </el-form-item>
          </el-form>
        </div>
      </div>

      <!--当事人基本资料-->
      <div style="width: 100%">
        <div class="bname" ref="block7" style="border-top: 1px solid rgba(165,169,175,0.29);padding-top:0.5%">当事人资料</div>
        <!--        <div style="color:blue;margin-top: 1%;font-size: 14px">怀疑药品</div>-->
        <div class="block" style="margin-top: 0.5%;">
          <el-form ref="reportForm" :model="reportForm" label-width="140px">
            <el-form-item label="姓名" style="width: 600px">
              <el-input  v-model="reportForm.partyName" :readonly="true" ></el-input>
            </el-form-item>
            <el-form-item label="年龄" style="width: 600px" >
              <el-input  v-model="reportForm.partyAge":readonly="true"  ></el-input>
            </el-form-item>
            <el-form-item label="工作年限">
              <el-radio-group v-model="reportForm.partyYearsOfExperience" onclick="return false">
                <el-radio label="01"><1年</el-radio>
                <el-radio label="02">1≤y≤2</el-radio>
                <el-radio label="03">2≤y≤5</el-radio>
                <el-radio label="04">5≤y≤10</el-radio>
                <el-radio label="05">10≤y≤20</el-radio>
                <el-radio label="06">≥20年</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="类别">
              <el-radio-group v-model="reportForm.partyCategory" onclick="return false">
                <el-radio label="01">在编</el-radio>
                <el-radio label="02">聘用</el-radio>
                <el-radio label="03">进修</el-radio>
                <el-radio label="04">实习</el-radio>
                <el-radio label="05">轮转</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="学历">
              <el-radio-group v-model="reportForm.partyEducation" onclick="return false">
                <el-radio label="01">中专</el-radio>
                <el-radio label="02">大专</el-radio>
                <el-radio label="03">本科</el-radio>
                <el-radio label="04">硕士</el-radio>
                <el-radio label="05">其他</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="职务">
              <el-radio-group v-model="reportForm.partyPosition" onclick="return false">
                <el-radio label="01">医疗</el-radio>
                <el-radio label="02">药剂</el-radio>
                <el-radio label="03">护理</el-radio>
                <el-radio label="04">医技</el-radio>
                <el-radio label="05">检验</el-radio>
                <el-radio label="06">工程技术</el-radio>
                <el-radio label="07">行政管理</el-radio>
                <el-radio label="08">后勤保障</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-form>
        </div>
      </div>

      <!--事件结果-->
      <div style="width: 100%">
        <div class="bname" ref="block5" style="border-top: 1px solid rgba(165,169,175,0.29);padding-top:0.5%">事件结果</div>
        <div class="block" style="margin-top: 0.5%;">
          <el-form ref="reportform" :model="reportForm" :rules="rules" label-width="140px">
            <el-form-item label="纠纷或者纠纷隐患的可能性">
              <el-radio-group v-model="reportForm.resultsPossibilityDispute" onclick="return false">
                <el-radio label="01">确定有</el-radio>
                <el-radio label="02">可能有</el-radio>
                <el-radio label="03">无</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="事件严重程度" prop="resultsEventSeverity">
              <dict-tag style="font-size: 15px;color: #dd524d" :options="dict.type.he_event_severity" :value="reportForm.resultsEventSeverity"/>
            </el-form-item>
            <el-form-item label="事件分级" prop="resultsEventClassification">
              <el-radio-group v-model="reportForm.resultsEventClassification" onclick="return false">
                <el-radio label="01" style="margin-top: 10px; margin-bottom: 10px">Ⅰ级事件: 发生错误，造成患者死亡 (包括损害程度I级)</el-radio>
                <el-radio label="02" style="margin-bottom: 10px">Ⅱ级事件: 发生错误，且造成患者伤害 (包括损害程度E、F、G、H级)</el-radio>
                <el-radio label="03" style="margin-bottom: 10px">Ⅲ级事件: 发生错误，但未造成患者伤害 (包括损害程度B、C、D级)</el-radio>
                <el-radio label="04">Ⅳ级事件: 错误未发生 (错误隐患)(包括损害程度A级)</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="伤害严重度" prop="resultsSeverityInjury">
              <el-radio-group v-model="reportForm.resultsSeverityInjury" onclick="return false">
                <el-radio label="01">死亡</el-radio>
                <el-radio label="02">极度严重</el-radio>
                <el-radio label="03">重度</el-radio>
                <el-radio label="04">中度</el-radio>
                <el-radio label="05">轻度</el-radio>
                <el-radio label="06">未造成伤害</el-radio>
                <el-radio label="07">无伤害</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-form>
        </div>
      </div>

      <!--报告者信息-->
      <div style="width: 100%">
        <div class="bname" ref="block6" style="border-top: 1px solid rgba(165,169,175,0.29);padding-top:0.5%">报告者信息</div>
        <div class="block" style="margin-top: 0.5%;">
          <el-form ref="reportForm" :model="reportForm" label-width="140px">
            <el-form-item label="事件呈报方式">
              <el-radio-group v-model="reportForm.reportMethod" onclick="return false">
                <el-radio label="01">主动呈报</el-radio>
                <el-radio label="02">投诉</el-radio>
                <el-radio label="03">他人报告</el-radio>
                <el-radio label="04">质量检查发现</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="其他信息备注">
              <el-input type="textarea" v-model="reportForm.reportOtherRemarks" placeholder="请输入内容" style="width: 300px"
                        :rows="6" resize="none" :readonly="true"></el-input>
            </el-form-item>
            <el-form-item label="附件图片" prop="images">
              <image-upload :limit="1" v-model="reportForm.reportAttachedImages" :readonly="true" />
            </el-form-item>
          </el-form>
        </div>
      </div>
    </div>
</template>


<script>
import ScrollPane from "@/layout/components/TagsView/ScrollPane";
import { addBasic ,getBasic} from "@/api/module/gjj/basic";

export default {
  components: {ScrollPane},
  dicts: ['he_use_of_medications','he_event_severity','he_discussion_qualitative_levels','he_measure_strengthen_communication','he_measure_improve_administration','he_measure_care_management','he_measure_strengthen_education','he_possible_causes_environment','he_possible_causes_process_system','he_possible_causes_consumable_drug','he_possible_causes_equipment','he_discussion_medical_malpractice','he_discussion_involves_patient','he_education', 'he_patient_gender', 'he_party_post', 'he_report_event_state', 'he_report_event_type', 'he_patient_age_grades', 'he_event_severity', 'he_review_status', 'he_report_status', 'he_position', 'he_event_classification', 'he_review_event_type', 'he_possibility_of_dispute', 'he_patient_involved', 'he_analyze_reports', 'he_fallback_status', 'he_occurrence_time_period', 'he_event_determinatione', 'he_situation_measures_event', 'he_patient_education_level', 'he_diagnosis_category', 'he_years_of_experience', 'he_severity_of_injury', 'he_reporting_method', 'he_patient_nursing_level', 'he_date_type', 'he_invalidation_status', 'he_patient_ethnic_group', 'he_category', 'he_handling_status','he_possible_causes_workers','he_possible_causes_patient','he_possible_causes_family'],

  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 事件上报信息表格数据
      reportList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      formEvent:{
        //代表是事件基本信息表
        heEventBasic: {},
        //代表事件上传信息表
        heEventReport: {},
        //代表事件流程表
        heEventFlow:{},
      },
      //代表事件基本信息表
      basicForm:{
        pathologySpecimenType:'',
        examineSpecimenInvasive:'',
        pathologyErrorType:'',
      },
      //代表事件上报信息表
      reportForm:{
        reportEventType:'29',
        reviewEventType:'01',
        //以下都是新增到事件上传信息表的字段
        //事件情况描述
        situationEdescriptionProcess: '',
        situationMeasuresEvent: '',
        situationTakenMeasures: '',
        situationCausesconsequences: '',
        //患者资料
        patientInvolved: '',
        patientDiagnosisCategory: '',
        patientRecordOutpatient: '',
        patientName: '',
        patientGender: '',
        patientDateOfBirth: '',
        patientAge: '',
        patientAgeStage: '',
        patientEthnicGroup: '',
        patientWeight: '',
        patientPreDisease: '',
        patientContact: '',
        patientFamilyNumber: '',
        patientAdmissionTime: '',
        patientDepartment: '',
        patientBedNumber: '',
        patientNursingLevel: '',
        patientEducationLevel: '',
        patientDiagnosis: '',
        //其他情况暂时没有字段以后加这里先写死
        //事件基本信息
        occurrenceTime: '',
        occurrenceDate: '',
        occurrenceDateType: '',
        occurrenceTimePeriod: '',
        occurrenceLocation: '',
        occurrenceScenePhotos: '',
        //当事人资料
        partyName: '',
        partyAge: '',
        partyYearsOfExperience: '',
        partyCategory: '',
        partyEducation: '',
        partyPosition: '',
        partyPost: '',
        //事件结果
        resultsPossibilityDispute: '',
        resultsEventSeverity: '',
        resultsEventClassification: '',
        resultsSeverityInjury: '',
        //报告者信息(上报信息)
        reportMethod: '',
        reportAttachedImages: '',
        reportOtherRemarks: '',
        reportDepartment:'',
        note1:'',
      },
      //代表事件流程表
      flowForm:{},
      // 表单校验
      rules: {
        resultsEventClassification:[{
          required:true,message:"上报不能为空",trigger:"blur"
        }],
        resultsEventSeverity:[{
          required:true,message:"上报不能为空",trigger:"blur"
        }],
        patientName:[{
          required:true,message:"姓名不能为空",trigger:"blur"
        }],
        resultsSeverityInjury:[{
          required:true,message:"上报不能为空",trigger:"blur"
        }]
      },
      fileList: [],
      optionsUseBlood: [
        {
          value: '1',
          label: '患者身份识别错误'
        },
        {
          value: '2',
          label: '血液收发错误'
        },
        {
          value: '3',
          label: '遗嘱申请错误'
        },
        {
          value: '4',
          label: '标本采集错误'
        },
        {
          value: '5',
          label: '血液质量问题'
        },
        {
          value: '6',
          label: '其他'
        },
      ],
      optionsAgeStage: [
        {
          value: '1',
          label: '1-6月'
        },
        {
          value: '2',
          label: '7-12月'
        },
        {
          value: '3',
          label: '1-6岁'
        },
        {
          value: '4',
          label: '7-12岁'
        },
        {
          value: '5',
          label: '13-18岁'
        },
        {
          value: '6',
          label: '19-64岁'
        },
        {
          value: '7',
          label: '65岁以上'
        },
        {
          value: '8',
          label: '其他'
        },
      ],
      optionsDepartment: [
        {
          value: '1',
          label: '信息科'
        },
        {
          value: '2',
          label: '外科'
        },
        {
          value: '3',
          label: '妇产科'
        },
        {
          value: '4',
          label: '儿科'
        },
        {
          value: '5',
          label: '麻醉科'
        }
      ],
      optionsSeverity: [
        {
          value: '1',
          label: 'A级：客观环境或条件可能引发不良事件（不良事件隐患）'
        },
        {
          value: '2',
          label: 'B级：不良事件发生但未累及患者'
        },
        {
          value: '3',
          label: 'C级：不良事件累及到患者但没有造成伤害'
        },
        {
          value: '4',
          label: 'D级：不良事件累及到患者需要进行检测以确保患者不被伤害，或需通过干预组织伤害发生'
        },
        {
          value: '5',
          label: 'E级：不良事件造成患者暂时性伤害并需要进行治疗或干预'
        },
        {
          value: '6',
          label: 'F级：不良事件造成患者暂时性伤害并需要住院或延长住院时间'
        },
        {
          value: '7',
          label: 'G级：不良事件造成患者永久性伤害，但不需要治疗挽救生命'
        },
        {
          value: '8',
          label: 'H级：不良事件发生并导致患者需要治疗挽救生命'
        },
        {
          value: '9',
          label: 'I级：不良事件发生导致患者死亡'
        },
      ],
    }
  },
  // 禁止web端屏幕缩放
  created() {
    //获取上一个页面传过来的id
    const id = this.$route.query.id;
    //通过id查询
    getBasic(id).then(response => {
      //获取后台传过来的表单
      this.formEvent = response.data;
      //将其对应赋值进行表单渲染
      this.basicForm=this.formEvent.heEventBasic
      this.reportForm=this.formEvent.heEventReport
    });
    this.xian();
    // window.addEventListener("mousewheel", function (event) {
    //   if (event.ctrlKey === true || event.metaKey) {
    //     event.preventDefault();
    //   }
    // }, {passive: false})
  },
  methods: {
    xian(){
      //用于多选框反显
      this.checkList=this.pushCheckbox(this.basicForm.bedTreatmentConditions)
      this.yuanyin=this.pushCheckbox(this.basicForm.fallCauses)
      this.chuli=this.pushCheckbox(this.basicForm.fallDisposal)
      this.dimian=this.pushCheckbox(this.basicForm.fallGroundConditions)
    },
    //用于多选框反显
    pushCheckbox(str){
      if(str==null){
        console.log("多选框未全选中")
      }else {
        const boxlist=str.split(',');
        return boxlist;
      }
    },
  },
}

</script>

<style lang="scss" scoped>
@import "src/views/module/shao/blackFont";
.content {
  margin-right: 1.5%;
  width: 87%;
}

.btn-box {
  position: fixed;
  margin-top: 1%;

  ::v-deep .el-card__body {
    padding: 15px 15px 15px 5px;
  }
}

.btn-box button {
  text-align: left;
  padding: 0 0 0 10px;
  display: block;
  width: 150px;
  height: 40px;
  border: none;
  cursor: pointer;
}

.btn-box button:hover {
  background: hsl(221, 98%, 68%);
  color: white;
}

.block {
  border: 1px solid white;
  width: 100%;
  height: 100%;
  display: flex;
  font-size: 5rem;
  box-sizing: border-box;

  .el-form-item {
    margin-bottom: 10px;
  }
}

.bname {
  font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
  font-weight: bold;
  font-size: 20px;
  color: black;
}

</style>
